﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace OpGen.Compiler.Parser
{
    /// <summary>
    /// Stellt eine Include Datei dar
    /// </summary>
    public class IncludeFile
    {
        /// <summary>
        /// Erstellt eine neue Instanz der IncludeFile-Klasse
        /// </summary>
        /// <param name="includeFile"></param>
        /// <param name="baseParser"></param>
        internal IncludeFile(FileInfo includeFile, IOpGenParser baseParser)
        {
            this.IncludeFileInfo = includeFile;

            var parser = new OpGenParser(includeFile, baseParser);
            parser.Execute();

            this.Project = parser.Project;
        }

        /// <summary>
        /// Liefert die Datei
        /// </summary>
        internal FileInfo IncludeFileInfo { get; private set; }

        /// <summary>
        /// Liefert die Include Projektdaten
        /// </summary>
        public ProjectElement Project { get; private set; }

        /// <summary>
        /// Liefert den Namen der Includedatei
        /// </summary>
        public string Name
        {
            get { return IncludeFileInfo.Name; }
        }

        /// <summary>
        /// Liefert den Dateinamen inklusive Pfad
        /// </summary>
        public string Fullname
        {
            get { return IncludeFileInfo.FullName; }
        }

        /// <summary>
        /// Liefert den Speicherort der Include Datei
        /// </summary>
        public string DirectoryName
        {
            get { return IncludeFileInfo.DirectoryName; }
        }
    }
}
